package com._21cn.cms.resource.utils.upload;

import com._21cn.cms.resource.utils.UploadHelper;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.util.List;
import java.util.Map;

/**
 * 上传处理接口
 * 
 * @author chenjh
 */
public interface UploadHandler {

	/**
	 * 处理上传文件的前置操作
	 * 
	 * @param request
	 * @param response
	 * @return
	 */
	boolean beforeUpload(HttpServletRequest request, HttpServletResponse response);

	/**
	 * 处理上传请求
	 * 
	 * @param request
	 * @param response
	 * @return
	 */
	Map<UploadHelper.UploadResultType, Map<String, File>> process(HttpServletRequest request, HttpServletResponse response);

	/**
	 * 处理上传文件
	 * 
	 * @param request
	 * @param response
	 * @return
	 */
	Map<UploadHelper.UploadResultType, List<Object>> afterUpload(
			Map<UploadHelper.UploadResultType, Map<String, File>> map, HttpServletRequest request,
			HttpServletResponse response);
}
